/*
 * Function.h
 *
 *  Created on: May 3, 2011
 *      Author: trungtq
 */

#ifndef FUNCTION_H_
#define FUNCTION_H_

#include <string>
#include <set>
#include <sstream>


using namespace std;

class Function {

public:
    Function();
    Function(string name, int arity);
    Function(const char* name, int arity);
    virtual ~Function();

private:
    string name;
    int arity;

public:
    // getter & setter
    int getArity() const;
    string getName() const;

public:
    bool equal(Function func);
    static bool equal(Function func1, Function func2);
    string toString() const;
};

class FunctionCompare {
public:
    bool operator() (Function func1, Function func2) {
        string s1 = func1.toString();
        string s2 = func2.toString();
        return (s1.compare(s2) < 0);
    }
};

typedef set<Function, FunctionCompare> FunctionSet;

#endif /* FUNCTION_H_ */
